package com.greensam.pixelengine;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.Banner;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Slf4j
@SpringBootApplication
public class PixelEngineApplication implements WebMvcConfigurer, CommandLineRunner {

    public static void main(String[] args) {
        new SpringApplicationBuilder(PixelEngineApplication.class)
                .bannerMode(Banner.Mode.OFF) // 关闭启动横幅（Banner）
                .headless(false) // 设置非 headless 模式（允许图形界面操作）
                .build(args)
                .run();
    }

    @Override
    public void run(String... args) throws Exception {
        log.info("Application started");
    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
    }
}
